//
//  SKYInfoAcquisitionModel.m
//  SkyonSDK
//
//  Created by 张二帅 on 2018/5/10.
//  Copyright © 2018年 Skyon. All rights reserved.
//

#import "SKYInfoAcquisitionModel.h"
#import "SKYCrashModel.h"
#import "SKYModel.h"
#import "NSArray+SKYSafeArray.h"
#import "SKYDevice.h"
#import "SKYApplication.h"
#import "SKYInfoServer.h"
#import "SKYBattery.h"
#import "SKYPageTrackerMonitor.h"

/*
 1 初次安装采集
 2 每次启动采集
 3 定期循环采集
 4 系统崩溃触发采集
 5 页面加载事件触发采集
 6 页面离开事件触发采集
 7 H5页面加载采集
 8 自定义事件采集
 */
typedef NS_ENUM(int,SKYScenarioType) {
    SKYScenario_FirstInstall = 1,
    SKYScenario_AppLaunch,
    SKYScenario_RegularLoop,
    SKYScenario_Crash,
    SKYScenario_PageDidAppear,
    SKYScenario_PageDidDisappear,
    SKYScenario_WebViewLoad,
    SKYScenario_CustomEvent
};


@implementation SKYInfoAcquisitionModel

/**
 初次安装采集信息

 @return 采集信息列表
 */
+ (NSArray *)fistInstallInfoAcquisitionPackets {
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名
    [array sky_addEmptyOrValueString:[SKYDevice getDefaultLanguage]];//设备默认语言
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceModel]];//设备型号
    [array sky_addEmptyOrValueString:[SKYDevice getSystemName]];//操作系统平台
    [array sky_addEmptyOrValueString:[SKYDevice getCarrierName]];//运营商类型
    [array sky_addEmptyOrValueString:[SKYDevice getSystemVersion]];//操作系统版本
    [array sky_addEmptyOrValueString:[SKYDevice getMCCAndMNC]];//移动国家码与网络码
    [array sky_addEmptyOrValueString:nil];//国际移动用户识别号码
    [array sky_addEmptyOrValueString:[SKYDevice getResolution]];//分辨率
    [array sky_addEmptyOrValueString:[SKYDevice getElapseBootTime]];//已开机时间
    [array sky_addEmptyOrValueString:[SKYDevice getAltitudeInfo]];//海拔高度
    [array sky_addEmptyOrValueString:[SKYDevice getSystemDateTime]];//系统日期与时间
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isLocationEnabled]]];//是否支持GPS
    [array sky_addEmptyOrValueString:[SKYDevice getLocationInfo]];//位置信息（经度、维度）
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isBluetoothSupported]]];//是否有蓝牙
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isConnectWifi]]];//是否连接了wifi
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isGyroscopeAvailable]]];//是否支持陀螺仪
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isMobile]]];//是否是移动设备
    [array sky_addEmptyOrValueString:[SKYDevice wifiMacAddress]];//wifi的mac地址
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符
    [array sky_addEmptyOrValueString:nil];//手机号
    [array sky_addEmptyOrValueString:nil];//手机序列号
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].netIp];//当前 IP地址
    [array sky_addEmptyOrValueString:[SKYDevice getScreenSize]];//屏幕尺寸
    [array sky_addEmptyOrValueString:[SKYDevice getDPI]];//屏幕密度DPI
    [array sky_addEmptyOrValueString:nil];//SIM卡信息
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isNFCAvailable]]];//是否支持NFC
    [array sky_addEmptyOrValueString:[SKYDevice getDiskSize]];//存储总空间
    [array sky_addEmptyOrValueString:[SKYDevice getUsedDiskSize]];//当前使用空间大小
    [array sky_addEmptyOrValueString:[SKYDevice getAvailableDiskSize]];//剩余空间大小
    [array sky_addEmptyOrValueString:nil];//蓝牙mac地址，目前无法获取
    [array sky_addEmptyOrValueString:[SKYDevice getCoreInfo]];//获取内核版本信息
    [array sky_addEmptyOrValueString:nil];//CPU序列号
    [array sky_addEmptyOrValueString:[SKYDevice cpuArchitectureDescription]];//CPU型号
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYDevice getCPUProcessorCount]]];//cpu核心数
    [array sky_addEmptyStringAmount:7];//添加7个空值
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey
    [array sky_addEmptyOrValueString:[SKYApplication getAppName]];//应用名称
    [array sky_addEmptyOrValueString:[SKYApplication getAppPackageName]];//应用包名
    [array sky_addEmptyStringAmount:15];//添加15个空值
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_FirstInstall]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_FirstInstall]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 启动采集

 @return 采集信息列表
 */
+ (NSArray *)appLaunchInfoAcquisition {
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名
    [array sky_addEmptyStringAmount:3];
    [array sky_addEmptyOrValueString:[SKYDevice getCarrierName]];//运营商类型
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[SKYDevice getMCCAndMNC]];//移动国家码与网络码
    [array sky_addEmptyOrValueString:nil];//国际移动用户识别号码
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[SKYDevice getElapseBootTime]];//已开机时间
    [array sky_addEmptyOrValueString:[SKYDevice getAltitudeInfo]];//海拔高度
    [array sky_addEmptyOrValueString:[SKYDevice getSystemDateTime]];//系统日期与时间
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[SKYDevice getLocationInfo]];//位置信息（经度、维度）
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isConnectWifi]]];//是否连接了wifi
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[SKYDevice wifiMacAddress]];//wifi的mac地址
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符
    [array sky_addEmptyOrValueString:nil];//手机号
    [array sky_addEmptyOrValueString:nil];//手机序列号
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].netIp];//当前网络 IP地址
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:nil];//SIM卡信息
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[SKYDevice getDiskSize]];//存储总空间
    [array sky_addEmptyOrValueString:[SKYDevice getUsedDiskSize]];//当前使用空间大小
    [array sky_addEmptyOrValueString:[SKYDevice getAvailableDiskSize]];//剩余空间大小
    [array sky_addEmptyOrValueString:nil];//蓝牙mac地址，目前无法获取
    [array sky_addEmptyStringAmount:4];
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].wifiNameList];//wifi热点列表
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentCPUFrequency]];//cpu频率
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryState]];//当前电池状态
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryLevel]];//当前电池电量
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYBattery getBatteryCapacity]]];//当前电池剩余容量（损耗百分比无法获取，电池容量可以获取）
    [array sky_addEmptyOrValueString:nil];//当前电池温度，无法采集，私有api
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.userId]];//用户ID(通过绑定)
    [array sky_addEmptyStringAmount:9];
    [array sky_addEmptyOrValueString:[SKYDevice getIDFA]];//广告标识符
    [array sky_addEmptyStringAmount:4];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_AppLaunch]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_AppLaunch]];//事件类型表述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 定期循采集环数据包
 
 @return 信息列表
 */
+ (NSArray *)regularInfoAcquisitionPackets {
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名
    [array sky_addEmptyStringAmount:8];
    [array sky_addEmptyOrValueString:[SKYDevice getElapseBootTime]];//已开机时间
    [array sky_addEmptyOrValueString:[SKYDevice getAltitudeInfo]];//海拔高度
    [array sky_addEmptyOrValueString:[SKYDevice getSystemDateTime]];//系统日期与时间
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isLocationEnabled]]];//是否支持GPS
    [array sky_addEmptyOrValueString:[SKYDevice getLocationInfo]];//位置信息（经度、维度）
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isConnectWifi]]];//是否连接了wifi
    [array sky_addEmptyStringAmount:3];
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符
    [array sky_addEmptyOrValueString:nil];//手机号
    [array sky_addEmptyOrValueString:nil];//手机序列号
    [array sky_addEmptyStringAmount:5];
    [array sky_addEmptyOrValueString:[SKYDevice getDiskSize]];//存储总空间
    [array sky_addEmptyOrValueString:[SKYDevice getUsedDiskSize]];//当前使用空间大小
    [array sky_addEmptyOrValueString:[SKYDevice getAvailableDiskSize]];//剩余空间大小
    [array sky_addEmptyStringAmount:7];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentCPUFrequency]];//cpu频率
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryState]];//当前电池状态
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryLevel]];//当前电池电量
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYBattery getBatteryCapacity]]];//当前电池剩余容量（损耗百分比无法获取，电池容量可以获取）
    [array sky_addEmptyOrValueString:nil];//当前电池温度，无法采集，私有api
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.userId]];//用户ID(通过绑定)
    [array sky_addEmptyStringAmount:14];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_RegularLoop]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_RegularLoop]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 崩溃信息采集
 
 @param crashDict 崩溃信息
 @return 采集信息list
 */
+ (NSArray *)crashInfoAcquisitionWithCrashDict:(NSDictionary *)crashDict {
    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[self eventInfoAcquisitionPermanentParameter]];
    SKYCrashModel *crashModel = [SKYCrashModel SKY_modelWithDictionary:crashDict];
    [array sky_addEmptyOrValueString:crashModel.user.currentPage];//崩溃发生页面
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:crashModel.report.timestamp]];//崩溃时间
    [array sky_addEmptyOrValueString:crashModel.crash.diagnosis];//崩溃捕获异常信息
    [array sky_addEmptyOrValueString:crashModel.user.cpuFrequency];//崩溃时CPU频率
    [array sky_addEmptyOrValueString:nil];//崩溃时电池温度，私有api无法获取
    [array sky_addEmptyOrValueString:crashModel.user.batteryLevel];//崩溃时电池电量
    [array sky_addEmptyOrValueString:sky_formatCapacitySize(crashModel.system.memory.free)];  //崩溃时空闲内存情况
    [array sky_addEmptyOrValueString:crashModel.user.backProcess];//崩溃时后台进程
    [array sky_addEmptyOrValueString:[self stringFromBool:crashModel.user.batteryIsCharging.boolValue]];//崩溃时是否在充电
    [array sky_addEmptyOrValueString:[SKYDevice getIDFA]];//广告标识符
    [array sky_addEmptyOrValueString:crashModel.user.currentPage];//崩溃时的页面访问路径：同崩溃发生页面一样
    [array sky_addEmptyOrValueString:crashModel.user.currentPageStartTime];//崩溃时页面开始加载时间
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_Crash]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_Crash]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 页面加载事件采集：页面名称、开始时间
 
 @param pageTrackerModel 页面追踪模型
 @return 采集信息list
 */
+ (NSArray *)pageDidAppearWithPageTrackerModel:(SKYPageTrackerModel *)pageTrackerModel {
    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[self eventInfoAcquisitionPermanentParameter]];
    [array sky_addEmptyStringAmount:9];
    [array sky_addEmptyOrValueString:[SKYDevice getIDFA]];//广告标识符
    [array sky_addEmptyOrValueString:pageTrackerModel.pageName];//页面名称
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:pageTrackerModel.startDate]];//页面访问时间
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_PageDidAppear]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_PageDidAppear]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 页面离开事件触发采集：页面名称、开始时间、页面离开时间、页面停留时长
 
 @param pageTrackerModel 页面追踪模型
 @return 采集信息列表
 */
+ (NSArray *)pageDidDisappearWithPageTrackerModel:(SKYPageTrackerModel *)pageTrackerModel {
    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[self eventInfoAcquisitionPermanentParameter]];
    [array sky_addEmptyStringAmount:9];
    [array sky_addEmptyOrValueString:[SKYDevice getIDFA]];//广告标识符
    [array sky_addEmptyOrValueString:pageTrackerModel.pageName];//页面名称
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:pageTrackerModel.startDate]];//页面访问时间
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:pageTrackerModel.endDate]];//页面离开时间
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%.2f",pageTrackerModel.stayTime]];//页面停留时长
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_PageDidDisappear]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_PageDidDisappear]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:4];
    return array;
}

/**
 事件采集固定参数列表(1-47)
 
 @return 信息列表
 */
+ (NSArray *)eventInfoAcquisitionPermanentParameter {
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名
    [array sky_addEmptyStringAmount:18];
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:nil];//手机序列号
    [array sky_addEmptyStringAmount:15];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentCPUFrequency]];//cpu频率
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryState]];//当前电池状态
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryLevel]];//当前电池电量
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYBattery getBatteryCapacity]]];//当前电池剩余容量（损耗百分比无法获取，电池容量可以获取）
    [array sky_addEmptyOrValueString:nil];//当前电池温度，无法采集，私有api
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey
    [array sky_addEmptyOrValueString:[SKYApplication getAppName]];//应用名称
    [array sky_addEmptyOrValueString:[SKYApplication getAppPackageName]];//应用包名
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.userId]];//用户ID(通过绑定)
    return array;
}

/**
 H5页面加载采集

 @param check_id cookie中的 check_id
 @param lgn_ur cookie 中的 lgn_url
 @param title web中的title
 @return 采集信息列表
 */
+ (NSArray *)webViewLoadInfoAcquisitionWithCookieCheck_id:(NSString *)check_id cookieLgn_ur:(NSString *)lgn_ur title:(NSString *)title urlString:(NSString *)urlString {
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyStringAmount:19];
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符20
    [array sky_addEmptyStringAmount:37];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",urlString]];//页面名称
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentPageStartTime]];//页面访问时间
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_WebViewLoad]];//事件类型编号62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_WebViewLoad]];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyOrValueString:check_id]; //cookie中的 check_id
    [array sky_addEmptyOrValueString:lgn_ur]; //cookie 中的 lgn_url
    [array sky_addEmptyStringAmount:1];
    [array sky_addEmptyOrValueString:title];
    return array;
}

/**
 自定义事件采集

 @param event 事件
 @param eventCode 事件编号
 @param eventDescribe 事件描述
 @return 采集信息列表
 */
+ (NSArray *)eventPacketsWithEvent:(NSString *)event eventCode:(NSString *)eventCode eventDescribe:(NSString *)eventDescribe;{
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名1
    [array sky_addEmptyStringAmount:18];
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符20
    [array sky_addEmptyStringAmount:22];
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号 43
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey 44
    [array sky_addEmptyOrValueString:[SKYApplication getAppName]];//应用名称 45
    [array sky_addEmptyOrValueString:[SKYApplication getAppPackageName]];//应用包名 46
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.userId]];//用户ID(通过绑定) 47
    [array sky_addEmptyStringAmount:10];
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentPageName]];//页面名称
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentPageStartTime]];//页面访问时间
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:(eventCode == nil ? [NSString stringWithFormat:@"%d",SKYScenario_CustomEvent] : eventCode)];//事件类型编号62
    [array sky_addEmptyOrValueString:(eventDescribe == nil ? [self stringFromSKYScenarioType:SKYScenario_CustomEvent] : eventDescribe)];//事件类型描述63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    [array sky_addEmptyStringAmount:2];
    [array sky_addEmptyOrValueString:event];
    [array sky_addEmptyStringAmount:1];
    return array;
}


/**
 采集参数示例（1-64）

 @param crashDict 崩溃信息
 @param pageTrackerModel 页面追踪信息模型
 */
+ (void)exampleInfoAcquisitionWithCrashDict:(NSDictionary *)crashDict pageTrackerModel:(SKYPageTrackerModel *)pageTrackerModel{
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceName]];//设备名1
    [array sky_addEmptyOrValueString:[SKYDevice getDefaultLanguage]];//设备默认语言2
    [array sky_addEmptyOrValueString:[SKYDevice getDeviceModel]];//设备型号3
    [array sky_addEmptyOrValueString:[SKYDevice getSystemName]];//操作系统平台4
    [array sky_addEmptyOrValueString:[SKYDevice getCarrierName]];//运营商类型5
    [array sky_addEmptyOrValueString:[SKYDevice getSystemVersion]];//操作系统版本6
    [array sky_addEmptyOrValueString:[SKYDevice getMCCAndMNC]];//移动国家码与网络码7
    [array sky_addEmptyOrValueString:nil];//国际移动用户识别号码8
    [array sky_addEmptyOrValueString:[SKYDevice getResolution]];//分辨率9
    [array sky_addEmptyOrValueString:[SKYDevice getElapseBootTime]];//已开机时间10
    [array sky_addEmptyOrValueString:[SKYDevice getAltitudeInfo]];//海拔高度11
    [array sky_addEmptyOrValueString:[SKYDevice getSystemDateTime]];//系统日期与时间12
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isLocationEnabled]]];//是否支持GPS 13
    [array sky_addEmptyOrValueString:[SKYDevice getLocationInfo]];//位置信息（经度、维度）14
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isBluetoothSupported]]];//是否有蓝牙15
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isConnectWifi]]];//是否连接了wifi 16
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isGyroscopeAvailable]]];//是否支持陀螺仪17
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isMobile]]];//是否是移动设备18
    [array sky_addEmptyOrValueString:[SKYDevice wifiMacAddress]];//wifi的mac地址19
    [array sky_addEmptyOrValueString:[SKYDevice uniqueDeviceIdentifier]];//唯一标识符20
    [array sky_addEmptyOrValueString:nil];//手机号21
    [array sky_addEmptyOrValueString:nil];//手机序列号22
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].netIp];//当前网络 IP地址23
    [array sky_addEmptyOrValueString:[SKYDevice getScreenSize]];//屏幕尺寸24
    [array sky_addEmptyOrValueString:[SKYDevice getDPI]];//屏幕密度DPI 25
    [array sky_addEmptyOrValueString:nil];//SIM卡信息 26
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isNFCAvailable]]];//是否支持NFC 27
    [array sky_addEmptyOrValueString:[SKYDevice getDiskSize]];//存储总空间 28
    [array sky_addEmptyOrValueString:[SKYDevice getUsedDiskSize]];//当前使用空间大小 29
    [array sky_addEmptyOrValueString:[SKYDevice getAvailableDiskSize]];//剩余空间大小 30
    [array sky_addEmptyOrValueString:nil];//蓝牙mac地址，目前无法获取 31
    [array sky_addEmptyOrValueString:[SKYDevice getCoreInfo]];//获取内核版本信息 32
    [array sky_addEmptyOrValueString:nil];//CPU序列号 33
    [array sky_addEmptyOrValueString:[SKYDevice cpuArchitectureDescription]];//CPU型号 34
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYDevice getCPUProcessorCount]]];//cpu核心数 35
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].wifiNameList];//wifi热点列表 36
    [array sky_addEmptyOrValueString:[self stringFromBool:[SKYDevice isJailbroken]]];//是否越狱 37
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",kSKYCurrentCPUFrequency]];//cpu频率 38
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryState]];//当前电池状态 39
    [array sky_addEmptyOrValueString:[SKYBattery getBatteryLevel]];//当前电池电量 40
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%lu",(unsigned long)[SKYBattery getBatteryCapacity]]];//当前电池剩余容量（损耗百分比无法获取，电池容量可以获取）41
    [array sky_addEmptyOrValueString:nil];//当前电池温度，无法采集，私有api 42
    [array sky_addEmptyOrValueString:[SKYApplication getAppVersion]];//应用版本号 43
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.appkey]];//渠道对应appkey 44
    [array sky_addEmptyOrValueString:[SKYApplication getAppName]];//应用名称 45
    [array sky_addEmptyOrValueString:[SKYApplication getAppPackageName]];//应用包名 46
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%@",[SKYInfoServer sharedInstance].config.userId]];//用户ID(通过绑定) 47
    SKYCrashModel *crashModel = [SKYCrashModel SKY_modelWithDictionary:crashDict];
    if (crashModel) {
        [array sky_addEmptyOrValueString:crashModel.user.currentPage];//崩溃发生页面 48
        [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:crashModel.report.timestamp]];//崩溃时间 49
        [array sky_addEmptyOrValueString:crashModel.crash.diagnosis];//崩溃捕获异常信息 50
        [array sky_addEmptyOrValueString:crashModel.user.cpuFrequency];//崩溃时CPU频率 51
        [array sky_addEmptyOrValueString:nil];//崩溃时电池温度，私有api无法获取 52
        [array sky_addEmptyOrValueString:crashModel.user.batteryLevel];//崩溃时电池电量 53
        [array sky_addEmptyOrValueString:sky_formatCapacitySize(crashModel.system.memory.free)];  //崩溃时空闲内存情况 54
        [array sky_addEmptyOrValueString:crashModel.user.backProcess];//崩溃时后台进程 55
        [array sky_addEmptyOrValueString:[self stringFromBool:crashModel.user.batteryIsCharging.boolValue]];//崩溃时是否在充电 56
    }
    [array sky_addEmptyOrValueString:[SKYDevice getIDFA]];//广告标识符 57
    [array sky_addEmptyOrValueString:pageTrackerModel.pageName];//页面名称 58
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:pageTrackerModel.startDate]];//页面访问时间 59
    [array sky_addEmptyOrValueString:[SKYInfoServer stringFromDate:pageTrackerModel.endDate]];//页面离开时间 60
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%.2f",pageTrackerModel.stayTime]];//页面停留时长 61
    [array sky_addEmptyOrValueString:[NSString stringWithFormat:@"%d",SKYScenario_FirstInstall]];//事件类型编号 62
    [array sky_addEmptyOrValueString:[self stringFromSKYScenarioType:SKYScenario_FirstInstall]];//事件类型描述 63
    [array sky_addEmptyOrValueString:[SKYInfoServer sharedInstance].config.appId];//appid 64
    
}




#pragma mark - 格式化方法
/**
 格式化bool值

 @param Bool bool值
 @return 格式化后字符串
 */
+ (NSString *)stringFromBool:(BOOL)Bool {
    return Bool ? @"true" : @"false";
}

/**
 格式化采集场景

 @param scenarioType 采集场景
 @return 对应字符串
 */
+ (NSString *)stringFromSKYScenarioType:(SKYScenarioType)scenarioType {
    switch (scenarioType) {
        case SKYScenario_FirstInstall:
            return @"初次安装采集";
        case SKYScenario_AppLaunch:
            return @"每次启动采集";
        case SKYScenario_RegularLoop:
            return @"定期循环采集";
        case SKYScenario_Crash:
            return @"系统崩溃触发采集";
        case SKYScenario_PageDidAppear:
            return @"页面加载事件触发采集";
        case SKYScenario_PageDidDisappear:
            return @"页面离开事件触发采集";
        case SKYScenario_WebViewLoad:
            return @"H5页面加载采集";
        case SKYScenario_CustomEvent:
            return @"自定义事件采集";
        default:
            break;
    }
    return [NSString stringWithFormat:@"%d",scenarioType];
}


@end
